package com.springboot.rookie.controller;

import com.springboot.rookie.pojo.CommonBean;
import com.springboot.rookie.pojo.MessageBean;
import org.springframework.stereotype.Controller;

import java.util.ArrayList;
import java.util.List;

@Controller
public class CommonController {
    //获取多语言选项
    public List<CommonBean> getLanguageList(String acceptLanguage) {
        List<CommonBean> items = new ArrayList<>();
        boolean isActive = acceptLanguage != null && acceptLanguage.contains("zh");
        CommonBean bean;
        bean = new CommonBean();
        bean.setId(0);
        bean.setName("language.chinese");
        bean.setDescribe("Chinese");
        bean.setActive(isActive);
        bean.setMarks("zh_CN");
        bean.setImage("/assets/img/translation/china.svg");
        items.add(bean);

        bean = new CommonBean();
        bean.setId(1);
        bean.setName("language.english");
        bean.setDescribe("English");
        bean.setActive(!isActive);
        bean.setMarks("en_US");
        bean.setImage("/assets/img/translation/america.svg");
        items.add(bean);

        return items;
    }

    //用户消息
    public List<MessageBean> getMessageList(Integer userId){
        List<MessageBean> items = new ArrayList<>();
        MessageBean bean;
        bean = new MessageBean();
        bean.setId(0);
        bean.setName("周六");
        bean.setContent("老大，服务员出现异常！");
        bean.setRead(false);
        bean.setImage("/assets/img/chat/chat-img-1.png");
        bean.setLevel(1);
        bean.setType(1);
        bean.setTime("15分钟前");
        items.add(bean);

        bean = new MessageBean();
        bean.setId(1);
        bean.setName("周末");
        bean.setContent("小周，三楼会议室开发啦！");
        bean.setRead(false);
        bean.setImage("/assets/img/chat/chat-img-2.png");
        bean.setLevel(1);
        bean.setType(1);
        bean.setTime("45分钟前");
        items.add(bean);

        return items;
    }

    //用户消息
    public List<MessageBean> getNotifyList(Integer userId){
        List<MessageBean> items = new ArrayList<>();
        MessageBean bean;
        bean = new MessageBean();
        bean.setId(0);
        bean.setName("message.new");
        bean.setImage("bi-envelope-fill");
        bean.setType(2);
        bean.setTime("5分钟");
        items.add(bean);

        bean = new MessageBean();
        bean.setId(1);
        bean.setName("notify.reports");
        bean.setImage("bi-file-earmark-fill");
        bean.setType(2);
        bean.setTime("30分钟");
        items.add(bean);

        return items;
    }
}
